package cn.edu.hitsz.http;

import java.util.Map;

/**
 * SET THE FETCH OPTIONS HERE SUCH AS THE PARAMETERS TO RETRIEVE A PAGE IN GET
 * AND POST METHOD AND HERE CAN ALSO SET THE CRAWL RULES AND ANY OTHER
 * CONTRAINTS USED TO FETCH A PAGE
 * 
 * @author mingchen
 * @date 2015年8月11日
 */
public class FetchOption {
	// para can contain the parameters to add to the url
	private final Map<String, Object> para;

	/**
	 * 
	 * Constructor function of Class
	 * 
	 * @param para
	 */
	public FetchOption(Map<String, Object> para) {
		this.para = para;
	}

	/**
	 * @return the para
	 */
	public Map<String, Object> getPara() {
		return para;
	}
	/**
	 * Parse the parameters to string 
	 * @return
	 * String
	 * 2015年8月11日
	 */
	public String getParaAsString() {
		String result = "";
		for (String key : para.keySet()) {
			result += key + "=" + para.get(key).toString() + "&";
		}
		result = result.substring(0, result.length() - 1);
		return result;
	}

}
